<template>
	<body-wrap>
		<view class="zxbmain">
			<view class="zxbInfo" v-for="dt in lists" :key="dt._id">
				<view class="xxbox">
					<view class="name">
						<text v-if="dt.orderType == 60">查看专家在线回复</text>
						<text v-else-if="dt.orderType == 61">线下咨询预约</text>
						<text v-else-if="dt.orderType == 62">一对一语音咨询</text>
					</view>
					<view class="syqk">
						产品价格：$<text class="price">{{dt.price}}</text>
					</view>
					<view class="syqk">
						使用人：{{dt.userId.name}}
					</view>
					<view class="express">使用时间：{{dateFormat('Y-m-d H:i',dt.createTime)}} </view>
				</view>
			</view>
			<empty v-if="lists && lists.length==0"/>
		</view>
	</body-wrap>
</template>

<script>
	import {defineComponent,reactive,toRefs,onMounted,getCurrentInstance,computed} from 'vue'
	import {onLoad,onShow} from '@dcloudio/uni-app'
	import { useStore } from 'vuex'
	import bodyWrap from "@/components/bodyWrap/index.vue"
	import cmImage from "@/components/cmImage/index.vue"
	import {getOrderList} from "@/api/consult.js"
	import {toast,dateFormat} from '@/utils/common.js'
	import empty from "@/components/empty/index.vue"
	export default defineComponent({
		components:{
			bodyWrap,
			cmImage,
			empty
		},
		props:{
		
		},
		setup(props,context) {
			const store = useStore()
			const {proxy} = getCurrentInstance()
			
			const state = reactive({
				userInfo:computed(()=>store.state.base.userInfo),
				lists:'',
				pageIndex:1,
				pageSize:20,
				orderId:''
			})
			
			onLoad(options=>{
				if(options && options.oid){
					state.orderId = options.oid
				}
				get_order_list()
			})
			
			onMounted(async ()=>{
				
			})
			
			const get_order_list = async ()=>{
				let params = {
					couponOrderId: state.orderId,
					pageIndex:state.pageIndex,
					pageSize:state.pageSize,
					status:1,
					payType: 6, // 6咨询包抵扣
				}
				const res = await getOrderList(params)
				state.lists = res.data.data || []
			}

			
			return {
				...toRefs(state),
				dateFormat
			}
		}
	})
</script>

<style lang="scss" scoped>
	.zxbmain{
		flex: 1;
		flex-shrink: 0;
		padding: 20rpx;
		.zxbInfo{
			display: flex;
			border-radius: 15rpx;
			box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
			background: #fff;
			padding: 20rpx;
			&+.zxbInfo{
				margin-top: 20rpx;
			}
			.xxbox{
				flex: 1;
				flex-shrink: 0;
				line-height: 50rpx;
				.name{
					font-size: 30rpx;
					font-weight: bold;
				}
				.express{
					font-size: 28rpx;
					color: #999;
					padding: 0;
				}
				.syqk{
					.price{
						color: #ba0000;
						font-weight: bold;
					}
				}
				.symxbox{
					display: flex;
					align-items: center;
					justify-content: flex-end;
					padding: 10rpx 0 0 0;
					.ubtn{
						display: flex;
						align-items: center;
						justify-content: center;
						min-width: 170rpx;
						height: 60rpx;
						border-radius: 40rpx;
						background: rgba(4, 148, 23,0.4);
						border: 1px solid #999;
						&+.ubtn{
							margin-left: 20rpx;
						}
						&.yqry{
							background: #e3af2f;
							border: 0;
							color: #fff;
						}
					}
				}
			}
			.rdbox{
				display: flex;
				align-items: center;
				padding: 0 0 0 15rpx;
			}
		}
	}
	.tabBox{
		display: flex;
		background: #fff;
		.item{
			display: flex;
			flex: 1;
			align-items: center;
			justify-content: center;
			height: 90rpx;
			font-size: 30rpx;
			&.selected{
				color: #e3af2f;
				position: relative;
				z-index: 10;
				&:before{
					content: '';
					position: absolute;
					z-index: 11;
					width: 100%;
					left: 0;
					bottom: 0;
					height: 2px;
					background: #e3af2f;
				}
			}
		}
	}
</style>
